package com.wjk.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wjk.entity.City;
import com.wjk.service.CityService;

@RestController
@RequestMapping("city")
public class CityController {

	private static Logger logger = LoggerFactory.getLogger(CityController.class);

	@Autowired
	private CityService cityService;

	@GetMapping("findall")
	public List<City> findAll() {

		List<City> cityAll = cityService.findAll();
		logger.info("city list reult are :" + cityAll);

		return cityAll;
	}

	@GetMapping("findbyid/{id}")
	private City findById(@PathVariable Long id) {
		City city = cityService.findById(id);
		logger.info("city list reult are :" + city);
		return city;
	}
}
